}
public function tablePrefix( $prefix = null ) {
- return $this->__call( __FUNCTION__, func_get_args() );
+ if ( $this->conn === null && $prefix === null ) {
+ $domain = DatabaseDomain::newFromId( $this->params[self::FLD_DOMAIN] );
+ // Avoid triggering a database connection
+ return $domain->getTablePrefix();
+ } elseif ( $this->conn !== null && $prefix === null ) {
+ // This will just return the prefix
+ return $this->__call( __FUNCTION__, func_get_args() );
+ }
+ // Disallow things that might confuse the LoadBalancer tracking
+ throw new DBUnexpectedError( $this, "Database selection is disallowed to enable reuse." );
}
public function dbSchema( $schema = null ) {
- return $this->__call( __FUNCTION__, func_get_args() );
+ if ( $this->conn === null && $schema === null ) {
+ $domain = DatabaseDomain::newFromId( $this->params[self::FLD_DOMAIN] );
+ // Avoid triggering a database connection
+ return $domain->getSchema();
+ } elseif ( $this->conn !== null && $schema === null ) {
+ // This will just return the schema
+ return $this->__call( __FUNCTION__, func_get_args() );
+ }
+ // Disallow things that might confuse the LoadBalancer tracking
+ throw new DBUnexpectedError( $this, "Database selection is disallowed to enable reuse." );
}
public function getLBInfo( $name = null ) {
}
public function setLBInfo( $name, $value = null ) {
- return $this->__call( __FUNCTION__, func_get_args() );
+ // Disallow things that might confuse the LoadBalancer tracking
+ throw new DBUnexpectedError( $this, "Changing LB info is disallowed to enable reuse." );
}
public function setLazyMasterHandle( IDatabase $conn ) {
- return $this->__call( __FUNCTION__, func_get_args() );
+ // Disallow things that might confuse the LoadBalancer tracking
+ throw new DBUnexpectedError( $this, "Database injection is disallowed to enable reuse." );
}
public function implicitGroupby() {
}
public function close() {
- return $this->__call( __FUNCTION__, func_get_args() );
+ throw new DBUnexpectedError( $this->conn, 'Cannot close shared connection.' );
}
- public function query( $sql, $fname = __METHOD__, $tempIgnore = false ) {
+ public function query( $sql, $fname = __METHOD__, $flags = 0 ) {
return $this->__call( __FUNCTION__, func_get_args() );
}
}
public function getDBname() {
+ if ( $this->conn === null ) {
+ $domain = DatabaseDomain::newFromId( $this->params[self::FLD_DOMAIN] );
+ // Avoid triggering a database connection
+ return $domain->getDatabase();
+ }
+
return $this->__call( __FUNCTION__, func_get_args() );
}
}
public function upsert(
- $table, array $rows, array $uniqueIndexes, array $set, $fname = __METHOD__
+ $table, array $rows, $uniqueIndexes, array $set, $fname = __METHOD__
) {
return $this->__call( __FUNCTION__, func_get_args() );
}